package controller;

import pojo.User;
import service.AdminService;
import service.impl.AdminServiceimpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author LiangHaiBo
 * @version 1.0
 * @date 2021.8.31 下午 19:22
 */
@WebServlet("/finduser")
public class FindUserServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        //从前台获取数据
        String uid = request.getParameter("uid");
        //调用业务层接口
        AdminService adminService = new AdminServiceimpl();
        User user = adminService.getUser(uid);

        request.setAttribute("user",user);

        request.getRequestDispatcher("admin/user_update.jsp").forward(request,response);

    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doGet(request,response);
    }
}
